New Heights for web applications

When it comes to programming, more specifically the development of web applications, it is important to consider all the tools of the trade before using the one that is going to be used for the job.

PHP is great. With the release at the time of PHP 4 and now its time for PHP 6. it’’s initial object functionality I started to get up to speed with many of the OOP principles. I was building some pretty amazing Content Management Systems, Digital Asset Management Systems, even Web Top Publishing Systems. My previous commitment to learn Java was fading as my experience grew with PHP was growing, seeing that I could build all the amazing things with what I had originally felt was a subordinate language.

We have search the performance for the PHP and many other languages like python,Perl,java,Vb,and finally ruby, below the difference between all the programming languages as graph which shows the future for the PHP.

Following graph shows the new lines of code in various languages in recent years

Newlinesofcode

PHP dominates the new lines of code and only PHP and Ruby are on a steady curve upward.  Yeah – I know that “number of lines of code” is not a great measure, but none of these languages are overly verbose so it’s an interesting proxy metric.

Activedevs

Active developers tells a different story.  While PHP is growing a little relative to the others, they all seem to have a relatively flat curve.  The well known shortage of Ruby developers is reinforced by this data, as well as the next graph.

Newprojects

Comparison between all the programing language..

Does it prove anything?

This was the chart I found really interesting.  Ruby is clearly the trendy new language.  Given normal supply / demand lags, you’d expect that this is a leading indicator of a significant uptick for Ruby on the other two charts in 2007.  My conclusion is different than Robin’s – while PHP appears to be dominant today, the rapid growth in new projects in Ruby indicates that it is currently positioned as “the language of the next wave of applications.”  This is consistent with what I’m hearing and seeing from many new startups.

Conclusion

I suspect very few people will argue that PHP is a more elegant language or is more powerful than Ruby. Frankly, Ruby is probably may favorite language that I have ever worked with and I have worked with Classic ASP, ASP.NET, VB.NET, C#, Java, and Perl all rather extensively over the years. Ruby is both highly expressive and concise which is rare and refreshing.

Rails is a very comprehensive and effective web development Framework and there’s nothing exactly like it in PHP. You get a huge amount of functionality for free. Developing in Ruby on Rails is also a very fast process because Ruby is a very concise language requiring much less typing than any other language I’ve worked with. Code Igniter is a really nice PHP framework. It will give you a great boost when developing your next PHP application.

The hosting and deployment struggles with Ruby on Rails is a major sticking point for me though. As the owner of a web development company many of our smaller clients do not have the budget for their own VPS account and even if they did, we don’t have the staff to manage a large number of VPS accounts or dedicated servers. Keeping the security updates current, managing any issues that may occur with email, and all the other headaches that go along with managing your own VPS or Dedicated server is more than we care to take on for the relatively small, practical difference between PHP and Ruby. For large projects, it may be worth the trouble, but for small to medium sized projects, PHP is much easier to deploy, less expensive to host, and the language is capable of taking on everything those types of sites require. For our projects, development time with PHP is not noticeably longer than with Ruby on Rails. Ruby on Rails integrates a lot of things for the developer.

There is ActiveRecord for managing the link between models and the database, migrations for keeping development and live databases in sync, built in testing, the ajax – prototype javascript library is included, and you get a well defined file system structure. While it may not all be packaged together as well, PHP can do all of the above.

Thank you for reading this and I would love to read your comments! Also subscribe to our RSS.

Implementing Websites For Internationalization

Most business in today’s open market are demanding their websites & web application to have multilingual support. This is in order to attract non-English speaking audiences to increase their customer base and make people comfortable using the application in their native language. But for this, it would require an existing business application to be customized to support native locale. The process of producing an application that can be localized for a particular country without any changes to the program code is called Internationalization.

Internationalization

Following are the list of things one needs to take care while making an application to implement Internationalization.

1. Producing Content in Unicode

You need to make sure that all files which contain the multilingual content are in Unicode format. By default most text editors will store your file in ASCII which does not support other language characters. So after saving any content in ASCII format and loading it, your browser might not be able to display correct text in native language. Here you need to convert the file from ASCII to UTF format.

For example, the steps required for doing this if you are using Notepad are,

    * Open your JavaScript or properties, etc. file in notepad
    * Go to > File > Save As > Encoding
    * Change Encoding from ASCII to UTF-8

2. Files needed to be converted to UTF

.properties

All your properties file should have a suffix based on the language in which the content is stored in this file. For example,

    * For English, content_en.properties for French content_fr.properties and so on.
    * Most java frameworks like Struts, Spring have inbuilt support to detect JVM locale and select the corresponding properties file based on the extension of the file & JVM/Browser setting. You don’t need to add any code to detect the setting and set the properties file

.java

Make sure that your JVM has set the parameter –Dfile.encoding=UTF-8

.js

Set charset attribute of the SCRIPT tag to “UTF-8″. For example,

    <script type=”text/javascript” src=”./urscript.js” charset=”UTF-8″></script>

.xml

Use the steps as in the first example to make sure the content within the XML files in is UTF-8 format.

.html/.htm

Add this line to head of all html pages.

    <meta name=”http-equiv” content=”Content-type: text/html; charset=UTF-8“/>

.jsp

Set Content-type explicitly through your server side scripts. To do this, add this line to all your jsp pages,

    <%@page contentType=”text/html; charset=UTF-8” pageEncoding=”UTF-8″%>

3. Configuring the Web Server

Your Web Server has to be configured to set the Content-type of headers to UTF-8 since by default the web server will replace the Content-type-header to ISO-8859 encoding. For example:

    * In Apache Web Server, edit httpd.conf to set AddDefaultCharset=Off.
    * In Tomcat Server set connector settings within the server.xml file to URIEncoding=”UTF-8″

4. Handling Request & Response Objects

Make sure that before reading request parameters & writing to response objects set character encoding type to UTF-8. This can be handled using filters where all the contents coming in and going out can be set to UTF-8 encoding. For example,

    * request.setCharacterEncoding(”UTF-8″);
    * response.setContentType(”text/html”);
    * response.setCharacterEncoding(”UTF-8″);

5. Creating Database with Unicode encoding

While using a database make sure that the database created has encoding set to UNICODE. Most of the database servers like Oracle, Postgress, MySQL and MSSQL have this support. In order to create databases with unicode encoding use the following query,

    CREATE DATABASE MyWebApps DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;

Once all the above steps are implemented your web application will work smoothly for all UTF-8 supported languages.