Pages

Showing posts with label Web Development. Show all posts
Showing posts with label Web Development. Show all posts

Sunday, April 05, 2009

PHP Frameworks: CodeIgniter

CodeIgniter is a php web development framework... In its own words:
CodeIgniter is a powerful PHP framework with a very small footprint, built for PHP coders who need a simple and elegant toolkit to create full-featured web applications. If you're a developer who lives in the real world of shared hosting accounts and clients with deadlines, and if you're tired of ponderously large and thoroughly undocumented frameworks
Instead of a web development framework I'd rather call it a collections of libraries that help you in developing a web application... I should continue with "easier" but is not actually like that, beacause "easier" for me means in the first place faster... The MVC pattern that tries to cover is actually going with some best practices and that's it... First time I tried CodeIgniter was at the recommendation of a fellow that was using CodeIgniter and was very happy with it... I tried to build a backend application for quote management, but I gave up and used a framework inspired by CakePHP, but quite truncated with a very good ORM... That was an unhappy experience and left CodeIgniter, and started using more and more CakePHP... The main reason I didn't continue with CodeIgniter was that I had to write lots of code... for everything I need I had to write code... And that's not helpful.. And after a year or so, at our company I got a very nice customer that was quite good four our image and decent pay... We already had a name, couple of large (national and multi-national companies) in out portfolio The code of the website was in 2 controllers (8k and 12k code code, yes that's 8.000 and 12.000 lines of code) and 2 views (the container of html code)... Of course CodeIgniter was used... They had no idea what they were doing in there....
class Start extends Controller {

function funcNameHere($paramx=''){
#code here
$data['content_html'] = 'html code here..';
#sql queries and stuff here... no models used...
#loops here to build the content
$this->load->view('main_view', $data);
}
#other 1000 functions here
}
So it's not at all easy to deal with this... But, without some extra-functionalities needed the application was working... Anyway, instead of rewriting the entire app, we just moved to a proper approach only the modules that needed to be changed... Details in another story maybe... This was another proof that using a Web Development Framework does not actually means writing quality code... My conclusions about CodeIgniter so far:
  • is a collection of libraries for developing web applications
  • not a RAD framework
  • too much code needed to be written
  • good documentation
  • lacks AJAX library
  • low complexity and easy to learn
  • weak ORM
So, a beginner that wants to use a framework, can start with CodeIgniter or if you need more control over your application also you can use CodeIgniter... I will be involved in projects that are built with CodeIgniter only if it's a requirement or it's easier than using something else. I prefer CakePHP (web applications development) and Zend Framework (as a toolkit)...

Sunday, February 15, 2009

Web Development PHP Frameworks News

I updated the Yahoo Pipes badge on the right column with the rss feed from Web Development PHP Frameworks Pipe. All the articles from CakePHP bakery were not well processed so I fixed that... Now you can watch these 4 main PHP frameworks in one place:
  • CakePHP
  • Symfony
  • Zend Framework
  • Code Igniter
Feel free to add any requests to this feed...

Friday, March 28, 2008

What can help your activity

I don't write that often on this blog. My intention was to offer some quality articles that can help you in your daily activity, no matter if you are a programmer, a web developer, a project manager or you have a lead position... The most successfull article is about Open-VPN on Windows Vista... Also the other technical articles are quite visited... So, now I ask you: what would help you in your daily activity? tech stuff, how-tos, advice, tips&tricks... I can cover a large scope of activities in many OS (win, linux, mac), programming languages, frameworks, project management and so on... Next action is to gather input, filter it and make a poll.

Friday, September 28, 2007

Oracle XE and PHP 5 on Windows

Even though most PHP applications use MySQL / SQLite / Postgres for database driven applications sometimes you need to integrate information from an Oracle database and you need PHP to do the talking. Oracle XE helped and encouraged developers to write applications using Oracle. So, there are several ways to connect to an Oracle:
  • using odbc
  • oci8 extension available for both PHP 4 and PHP 5
  • PDO (pdo_oci)
I will present some basic configuration for accesing Oracle [XE] database using OCI extension and PDO. PHP using OCI8 to access Oracle XE database First of all make sure the server (Oracle instance) is running and you have a valid user/password combination. Also make sure, the user is not locked. In php.ini uncomment:
extension=php_oci8.dll
Note: make sure extension_path is set correctly. php_oci8.dll depends on oci.dll. You can find oci.dll in oracle bin folder (something like \oraclexe\app\oracle\product\10.2.0\server\BIN). Copy oci.dll in %WINDIR%\system32. Now restart apache web server. Sample connection script:
$ora_conn =  oci_connect('hr','****','xe');
$sql = "SELECT * FROM EMPLOYEE";

$statement = oci_parse ($ora_conn, $sql);
oci_execute ($statement);
while ($row = oci_fetch_assoc($statement)) {
print_r($row);
}
oci_free_statement($statement);
And that's about it. PHP using PDO to access Oracle XE database Uncomment in php.ini the following lines:
extension=php_pdo.dll
;...
extension=php_pdo_oci.dll
Also, see above note referring to oci.dll. Restart Apache web server. Sample script using PDO:

try {
    $dbh = new PDO('oci:host=localhost;dbname=xe', 'hr', '*****');
    $rs = $dbh->query('SELECT * from EMPLOYEES WHERE ROWNUM<10');
    
    if($rs) {
        foreach ($rs as $row) {
            print_r($row);
        }
    } 

    $dbh = null;
    
} catch (PDOException $e) {
    print 'Error!: ' . $e->getMessage();
    die();
}
}

Tuesday, August 15, 2006

GWT Beta Version 1.1

Well, Google Web Toolkit beta version 1.1 has been released. On July 21st they said that the next release will have:
  • Localization Easily localize strings and formatted messages
  • XML classes An XML library based on the W3C DOM
  • JSON classes JSON is moving into gwt-user.jar, and it's much faster than the sample in 1.0.21
  • FileUpload widget The much-requested file upload widget
  • FormPanel widget Easily submit traditional HTML forms from GWT apps
  • RPC optimizations Speed improvements and a more compact wire format
  • JUnit enhancements Unit tests are much, much faster than in 1.0.21, and you can now test asynchronous things like RPCs and timers
Also, annouced that Maven is used for the building process. More features in current release:
  • Automatic resource injection Modules can contain references to external JavaScript and CSS files, causing them to be automatically loaded when the module itself is loaded.
  • gwt-servlet.jar Deploy this jar to add RPC to your servlet-based webapps without having to manually crack open gwt-user.jar to remove the servlet API classes.
  • Javadoc-style API documentation By popular demand :-)
  • An automatic mechanism to stop the browser from caching the .nocache.html file for your module.
I'm still waiting for a large scale app, built with GWT.

Sunday, August 13, 2006

Phalanger - PHP Compiler for .NET

The original description is:
The Phalanger is a complex solution giving web-application developers the ability to benefit from both the ease-of-use and effectiveness of the PHP language and the power and richness of the .NET platform. This solution enables developers to painlessly deploy and run existing PHP code on an ASP.NET web server and develop cross-platform extensions to such code taking profit from the best from both sides. Compatible with PHP 5.0, the object model in Phalanger enables to combine PHP objects with the .NET ones. It is possible to use a class written in PHP from a .NET application or even to import a .NET class (written for example in C# or Visual Basic .NET) into PHP scripts provided that this class respects the PHP object model implemented in the Phalanger. The Phalanger is the only existing PHP compiler which produces .NET Framework MSIL bytecode.
Some benchmarks were posted on the website with Phalanger 1.0 Beta 3, PHP 4.3.11, and PHP 5.0.4 with and without Zend Optimizer, and some php based popular apps: Nuke and phpBB compared. The tests were done on a Windows machine. Anyway, looking at the benchmarks Roadsend seems interesting too. The idea is that PHP for .NET is a viable solution, and compiled php is an improvment.

Thursday, March 09, 2006

Zend framework preview

Zend framework preview is out... after some quick fixes, the discussions started... Chris Shiflett wrote a tutorial for php|arch (in a big hurry it seems)... I consider the Model in an MVC framework a key component, while in this tutorial Chris uses a Database object, no ZActiveRecord ( I thought zend will find the Panacée for Active Record), no ORM library (Zend_Db_Table - Row Data Gateway, Zend_Db_Table_Row or any Zend_Db component). He explains that: "Because the database components of the Zend Framework are still relatively unstable, I use a class for storing and retrieving news entries and comments" ... Is understandable because this is just a preview release, but I was expecting more... The coding standards are not followed... (tabbed indented files, 2 spaces indented file)... It seems there is alot of work to be done.. Yesterday Zend Framework Preview 0.1.2 was released; important updates: unit tests and controller documentation :) For testing is used: PHPUnit2, not simpleTest, not Test::More... I hope that soon we will see a stable framework, that can be compared with Zope...

Saturday, February 26, 2005

On CSS

Nandini Doreswamy published on alistapart an article on Bulleted Lists: Multi-Layered Fudge. The idea is to create 2 side by side paragraphs and each one to have a bulleted list: sample Nice idea, I'm thinking about using something similar in my next design for this blog. This can replace the current static position that I applied. Continuing on CSS, on Digital Web magazine I found an article in which Karen Morrill-McClure writes a review on The Zen of CSS Design, a book about the designs found on csszengarden.com. Actually, I find this book for beginners in CSS, those who want to understand what CSS can do and why use such design. The two articles that are posted before this one, are interviews with the author's. Seems this week is dedicated to that book :). On mezzoblue is mentioned the book articles triade.

Sunday, February 06, 2005

PHP Security Consortium (PHPSC) was launched

On 31st January PHP Security Consortium (PHPSC) was launched. " Founded in January 2005, the PHP Security Consortium (PHPSC) is an international group of PHP experts dedicated to promoting secure programming practices within the PHP community. Members of the PHPSC seek to educate PHP developers about security through a variety of resources, including documentation, tools, and standards." [about] The website has a simple design, common to wikki style. You can see it just has launched: 1 article (Using PEAR's Text_CAPTCHA to Secure Web Forms, by Marcus Whitney), 1 project (PHP Security Guide 1.0 (English) HTML,docBook Lite [soon will be available as pdf]. Today is 6th feb. and still no update since 31st jan... I printed the security guide to study it, that caused my printer to run out of paper, I'll have to buy some more...

How to install and configure your own web server

Install Apache2, PHP 4.3.10 and MySQL

Here is a quick tutorial to make your own web server [Apache, PHP4, MySQL] on Windows. Of course you can always download an already made server suite, but all you do next, next, next... and then edit your php scripts. Installing your own web server and configuring it will improve your knowledge in this field, and gives you the oportunity to configure it for your own needs. Download [latest stable realeses]: Apache [httpd-2.0.52-win32-x86-src.zip] PHP PHP 4.3.10 zip package MySQL 4.1.9 [I still use MySQL 3.23] Create a folder on your disk C:\www Run apache installer:
- install location c:\www
[default c:\program files\apache group]:
so it will install c:\www\apache2
- Hostname: localhost or your IP address
- Listen: 80
- admin email address: youremail@address.com
- finalize install
Create the folder: c:\www\htdocs Unzip php-4.3.10-Win32.zip to c:\www\php4 Copy [or cut] c:\www\php4\sapi\* to c:\www\php4\* Rename php.ini-dist to php.ini and edit it:
; The root of the PHP pages, used only if nonempty.
; if PHP was not compiled with FORCE_REDIRECT, you SHOULD set doc_root
; if you are running php as a CGI under any web server (other than IIS)
; see documentation for security issues.  The alternate is to use the
; cgi.force_redirect configuration below
doc_root = c:/www/htdocs
;...........................
extension_dir = "c:/www/php4/extensions"
; Uncoment eny extension that you may need
extension=php_xslt.dll
;............... display all error except notices
error_reporting  =  E_ALL & ~E_NOTICE
;displaying script errors:
display_errors = On
; if you are using for production is it recommended to be set to Off

Note: php_xslt.dll requiers sablot.dll [placed under %WINDIR%\system32] php_exif requires php_mbstring.dll loaded BEFORE. For other extensions check documentation first. Copy php.ini in your %WINDIR% directory [that is c:\windows or c:\winnt] Configure apache to handle php scripts: Open and edit c:\www\apache2\conf\httpd.conf
ServerRoot "C:/www/Apache2"
#....edit
Listen 80
#.....ad the line
LoadModule php4_module /www/php/php4apache2.dll
#....edit
ServerName localhost:80
#...edit
DocumentRoot "C:/www/htdocs"
#...edit
DirectoryIndex index.html index.php default.php index.html.var
#add the lines:
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
Save it and restart Apache [Apache Monitor->Apache2->Restart]. MySQL: Unzip mysql to c:\www\mysql and run c:\www\mysql\bin\winmysqladmin.exe, set root password and you will have mysql databaser server running. I also recommend phpMyAdmin for querying and administering mysql server. Now testing instalation: create a file index.php in c:\www\htdocs and put the following content: <? phpinfo(); ?> then open your browser and go to: http://localhost/ and you should see:

PHP Version 4.3.10 ....

If not, well there is a problem. Send me an email and I will try to help you. Hope this can help... This is mainly the way I've done it several times and it worked on Windows 2000, windows xp, sp2, and last evening was running on windows media center 2005. I also installed mod-python, but that will be another post :)