|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Announcements
Chapters
Services
Feature Zones
|
IntroductionPorting the ASP.NET application for the Race to Linux has been quite a challenge this week. I was eager to test my latest development tools, which include a small persistent PHP framework with a data access layer, and a new novice-friendly generative software development application I call Code Stylist IDE. These tools were written by me and are available from my software company, Megapump, Inc. Porting from ASP.NETFirst things first, I looked at the table schemas for the ASP.NET Issue Tracker. Hmm, 18 tables, not a trivial project! I shortened the table names a bit and began creating the PostgreSQL tables via Code Stylist. Next, I mapped the relationships between the tables, and in less than an hour I had 90% of the PHP, SQL, CSS, JavaScript and the HTML template code ready to go. In fact, I could have submitted my entry the same day but the contest requirements stipulated that the ported application should look nearly identical to the original. ChallengesThe hardest part about porting the ASP.NET application to PHP was trying to thread the auto-generated back-end code into the repurposed front-end code. I saved the original pages as HTML and used the web browser OmniWeb (it has a great 'Reformat' command) to tidy it up before extracting the crucial bits of the layout code. I was very much impressed by the ASP.NET output, it was quite concise and Microsoft has some amazing JavaScript wizardry going on in there. Unfortunately, given that this was a Race, I decided right away to implement much of that functionality server-side (in PHP) rather than try to adapt the JavaScript. Given more time it might be possible to take advantage of some of that infrastructure. The templateAfter analyzing the HTML from the ASP.NET application, I was able to slice the header, footer and the sidebar code that was common to each page. I added a %content% tag at the center and pasted it into the template view in Code Stylist. On previewing or publishing, the %content% tag gets replaced with
The pagesThe default page generators plus the user-defined table relationships were all I needed to instantly build the complete page and the template views and controllers, including the complex multi-table IntegrationThe final step of porting the ASP.NET application to PHP was to replace the form input names so that they matched the auto-generated controller code. For instance, in the ASP.NET implementation an input field has code like name="txtTitle", but the generated code uses tablename_fieldname so I would change the source to name="issues_title" and that was the routine throughout. After getting the forms sorted out, I added behaviors with simple JavaScript for the various buttons, and server-side code to populate popup menus. ResultsThe resulting application looks and works almost exactly like the original, since it shares most of the same HTML. It was a lot of painstaking handiwork to get everything functional, but my new generative coding methods were of big help and are sure to improve from the experience that I have gained. This code will be implemented for MySQL, keep an eye on this for more "developments". The environmentI tested with PHP 4.3.11 and PostgreSQL 7.4.8, but everything should work under PHP 5 as well. Code Stylist IDE (Windows, Mac, Linux) can output the IssueTracker.cst project file to MySQL or PostgreSQL, with more databases to be supported soon. Setting it up (short version)PostgreSQL
MySQL (new!)
Setting it up (SUSE Linux step-by-step)You must be logged in with a standard (not root) user account.
System settingsIf you get 'error in connect function of PostgreSQL class'In the issue_tracker/config.php file, set And(As root) check the access control file called pg_hba.conf. On many systems (RedHat/SUSE) it's in /var/lib/pgsql/data. You can find it like this: 'find / -name pg_hba.conf' and edit it like this 'pico /var/lib/pgsql/data/pg_hba.conf'. At the end of the file you can paste the following two lines: host all all 0.0.0.0 255.255.255.255 trust
local all all trust trust
All other lines should be commented out with a '#'. Now restart PostgreSQL (as root) '/etc/init.d/postgresql restart' Final possibilityYou may need to set 'tcpip_socket = true' in /var/lib/pgsql/data/postgresql.conf. Change issue_tracker/config.php to use $db_host='localhost'; and $db_port='5432';. And finally restart PostgreSQL.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||